import type { InjectionKey } from "vue";
import type { CollapseProps } from "../config";

export interface CollapseContext {
	props: Required<CollapseProps>;
	addField: (field: CollapseItemContext) => void;
	removeField: (uid? : string) => void;
	onChange: (target: {
		expanded: boolean
		uid: string
		name: string|number
	}) => void
}

export interface CollapseItemContext {
	uid: string,
	states: {
		expanded: boolean,
		name: string|number
	},
	init: () => void
	setContentAnimate: () => void
}

export const collapseItemContextKey: InjectionKey<CollapseItemContext> = Symbol(
	"ECollapseItemContextKey"
);
export const collapseContextKey: InjectionKey<CollapseContext> =
	Symbol("ECollapseContextKey");
